using SalesPages.DomainModel;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity.ModelConfiguration;
namespace SalesPages.EntityFrameworkRepository.Mapping
{
    public class RioLuckyDrawMap : EntityTypeConfiguration<RioLuckyDraw>
    {
        public RioLuckyDrawMap()
        {
            // Primary Key
            this.HasKey(t => t.RioLuckyDrawId);

            // Properties
            // Table & Column Mappings
            this.ToTable("RioLuckyDraw");
            this.Property(t => t.RioLuckyDrawId).HasColumnName("RioLuckyDrawId");
            this.Property(t => t.RioUserId).HasColumnName("RioUserId");
            this.Property(t => t.Source).HasColumnName("Source");
            this.Property(t => t.CreatedDate).HasColumnName("CreatedDate");

            // Relationships
            this.HasRequired(t => t.RioUser)
                .WithMany(t => t.RioLuckyDraws)
                .HasForeignKey(d => d.RioUserId);

        }
    }
}
